package hn.cch.controller;


import hn.cch.entity.Master;
import hn.cch.message.JsonResponse;
import hn.cch.template.MasterTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/master/")
public class MasterController {

    private Logger logger = LoggerFactory.getLogger(TestController.class);

    @Autowired
    private MasterTemplate masterTemplate;



    @RequestMapping("getAll")
    @ResponseBody
    public JsonResponse getAll(){
        logger.info("master.getAll");
        List<Master> all = masterTemplate.getAll();
        logger.info("all:{}", all);
        return JsonResponse.success(all);
    }


}
